﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;



namespace _2011DBProject
{
    public partial class Server : System.Web.UI.Page
    {

        protected void Page_Load(object sender, EventArgs e)
        {
            if ((string)(Session["USER"]) == null)
            {
                Response.Redirect("default.aspx?isNoSession=1");
            }
        }


        protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                DataRowView dr = e.Item.DataItem as DataRowView;
                Button btnServer = e.Item.FindControl("btnServer") as Button;
                btnServer.CommandArgument = dr["SERVER_NO"].ToString();
            }
        }
        protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            if (e.CommandName == "serverSelect")
            {
                Session.Add("SERVER", Convert.ToInt32(e.CommandArgument));
                Settings.decServer = Convert.ToInt32(e.CommandArgument);
                Response.Redirect("Character.aspx");
            }
        }
        
        protected void Button3_Click(object sender, EventArgs e)    // 가상락커룸버튼
        {
            Response.Redirect("VirtualLockerRoom.aspx");
        }
        protected void Button4_Click(object sender, EventArgs e)    //계정정보
        {
            Settings.RefreshSessionVariables(false, true);
            Response.Redirect("Account.aspx");
        }
        protected void Button5_Click(object sender, EventArgs e)    //상품구매
        {
            Settings.RefreshSessionVariables(false, true);
            Response.Redirect("PaymentProcessing.aspx");
        }
        protected void Button6_Click(object sender, EventArgs e)    //결제내역
        {
            Settings.RefreshSessionVariables(false, true);
            Response.Redirect("PaymentHistory.aspx");
        }

        protected void btnGoLogout_onclick(object sender, EventArgs e)
        {
            Session.Clear();
            Response.Redirect("Default.aspx");
        }



    }
}
